<?php

abstract class Scheduler {
	
	private $listeners = array();
	
	/**
	 * Check whether the scheduler is standby
	 * 
	 * If the scheduler is in standby mode, it can't response
	 * for the command and don't schedule the task any more
	 * 
	 * @return	bool	True if the scheduler is standby, 
	 * 					otherwise false
	 */
	public abstract function isStandby();
	
	/**
	 * Add jobs to shedulers
	 * 
	 * @param	array	A list of jobs
	 * 
	 */
	public abstract function addJobs($jobs);
	
	/**
	 * Begin schedule jobs to create tasks
	 */	
	public abstract function scheduleJobs($baseDate);
	
	/**
	 * Begin run tasks
	 */	
	public abstract function scheduleTasks($baseDate);
	
	/**
	 * Stop the scheduler
	 */
	public abstract function stop();
	
	/**
	 * Check whether there is a scheduler is running
	 */
	public abstract function isRunning();
	
	/**
	 * Add listener to scheduler
	 * 
	 * @param SchedulerListener $listener
	 */
	public function addListener($listener) {
		$listeners[] = $listener;
	}
	
	/**
	 * Get the running time of scheduler
	 * 
	 */
	public function runningSince() {
		
	}
}
?>
